UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ER5YHrZfqy5jKe6NTQUazCZlICGTOKrPd4p3cbvd4PA='
WHERE
key_id = '52c88231f6c0626465216c468ab8365b6c5ee1110040438791ac5139cc123a41'
AND (
token = 'ER5YHrZfqy5jKe6NTQUazCZlICGTOKrPd4p3cbvd4PA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)