UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gZ0ZWd79VD07zPoBQT9YDaq84+2FY+dnpB/NvfzgWNQ=' 
WHERE 
  key_id = '3729db641e0cb26e162fc980717b31fcbbc4a7ea723349ad207b90a0f60f43a3' 
  AND (
    token = 'gZ0ZWd79VD07zPoBQT9YDaq84+2FY+dnpB/NvfzgWNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048