UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gQqiEEqjivLm/Vp542S0b0J9aGJvDXtnw0USti46C/4='
WHERE
key_id = '1474bb7701e3181a4a94b134d64453f54afa701076ff94f2305e6f28d093b76a'
AND (
token = 'gQqiEEqjivLm/Vp542S0b0J9aGJvDXtnw0USti46C/4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)