UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ddhsD+SICqPvLa/92pHR3Ix64idjmeUgISpJZtZ4CoM='
WHERE
key_id = '215cfa592fc442ef38f41fb22a47ecb0921e451f99228d1972100e5b009b5cd2'
AND (
token = 'ddhsD+SICqPvLa/92pHR3Ix64idjmeUgISpJZtZ4CoM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)