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