UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lgU/KGbC9AS/FNt5vIjcX7j9SB17cGvCaCuALZztPCU='
WHERE
key_id = 'ed5e29ff522cccc6184fb74688de758f094938d007595fda147ae34ff5258a1e'
AND (
token = 'lgU/KGbC9AS/FNt5vIjcX7j9SB17cGvCaCuALZztPCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)