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