UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nBeW8oJ4xGar2g6QHLHDNXkROIwtBr+TK56Epb66JgE='
WHERE
key_id = 'f7146e3300603b4b19c48fbb64c79147a2237a9035967b8df7d4703f59c3510c'
AND (
token = 'nBeW8oJ4xGar2g6QHLHDNXkROIwtBr+TK56Epb66JgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)