UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0N5wYXZhHlVGcVboJk+MivqlSo31ERrhbiDgQVQDjDM='
WHERE
key_id = '3cc2f3b80c31926fa26f4b82a831a25e94d5f3ae3c01c1165348c4077b73f1a7'
AND (
token = '0N5wYXZhHlVGcVboJk+MivqlSo31ERrhbiDgQVQDjDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)