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