UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JX6lthB+RbIKlX2LTdPy7nA9iVLetQP45ZbxvSQ33s8='
WHERE
key_id = 'a66a6db80de48825734c05176a26637fa8779bcde5fbb16c3589f0dda00869f5'
AND (
token = 'JX6lthB+RbIKlX2LTdPy7nA9iVLetQP45ZbxvSQ33s8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)