UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gc0xt9M4QDD9kPtxtAVFXBrAJEMq4ZnJ5isih8FzH74='
WHERE
key_id = 'f1f6ddf8f7758b97fd347118706f9a503c2f87711f22ac3a49b0646675134fc8'
AND (
token = 'gc0xt9M4QDD9kPtxtAVFXBrAJEMq4ZnJ5isih8FzH74='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)