UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKntJuQSqJE8bDUKEMM54it8Wok35qPZEmxm2dvrQSY='
WHERE
key_id = '305ff2774188871cc1377a65b028f16961594cf02efbb34eaa582a208973223b'
AND (
token = 'KKntJuQSqJE8bDUKEMM54it8Wok35qPZEmxm2dvrQSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)