UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9CXhAkCzhQv9FIllok1MiLQvIvZbMTugAcCTTKxUVM='
WHERE
key_id = '3140d21fda402400cd2b0972e0cb94ba6770c10c1339c0b85237423b12698316'
AND (
token = 'd9CXhAkCzhQv9FIllok1MiLQvIvZbMTugAcCTTKxUVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)