UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0NzuoORUVDXKnPdLSrd485xC17o948gVT06NFLb3JhE='
WHERE
key_id = 'a1f1da4b560a5d259515e12d0ce1ca9a785114e992459049866e0acf36c639df'
AND (
token = '0NzuoORUVDXKnPdLSrd485xC17o948gVT06NFLb3JhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)