UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RH9zGlxSle0TE9PSXzzwiEoGdQnNUgNRZlfUQjS0sBU='
WHERE
key_id = 'caf4d2840a0da4068abf759984c52a6699ee06350ab3a04c4fb27593869742d7'
AND (
token = 'RH9zGlxSle0TE9PSXzzwiEoGdQnNUgNRZlfUQjS0sBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)