UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3P7fTEnEsx3SIx5S9AlExcZlYphI75gZ+g7krnt+qg0='
WHERE
key_id = '97c3d3fe44f721676038ac742beb426d5cbcb72e8aae91bc199328c99c090176'
AND (
token = '3P7fTEnEsx3SIx5S9AlExcZlYphI75gZ+g7krnt+qg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)