UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UESuikUPMWGzQOpxmheHOlzaGFHa50FPa876R+19MEQ='
WHERE
key_id = 'befa43a3f37861f64f18312daf4b34de4f6b89ddca3bd790ba8e8cb0387f691f'
AND (
token = 'UESuikUPMWGzQOpxmheHOlzaGFHa50FPa876R+19MEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)