UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3seIVtU5M7p5NhnMm8GAzPiMboKn3NZnxK8JBzZGxA4='
WHERE
key_id = '9187b52a276757fe9cb2b54ada29b3d226cc82a7be0352b1d390e8750f882557'
AND (
token = '3seIVtU5M7p5NhnMm8GAzPiMboKn3NZnxK8JBzZGxA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)