UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aY0qG9WXpfzsIY9Gzy3+JxTxDaWTew/VjiPFds3E+f4='
WHERE
key_id = '88535570f63a8aa3737ceb354effffded052a95fb46a3b29694cf6d412ecc72a'
AND (
token = 'aY0qG9WXpfzsIY9Gzy3+JxTxDaWTew/VjiPFds3E+f4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)