UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5csotzAAQq1fe1iL9CA6yw3P5abQ71Ana/2R3ST9VK4=' 
WHERE 
  key_id = '51a5ee1ebc5e36dc984bd44e10aefe5a129d3b704f22e8d0e8f38c6616f90f14' 
  AND (
    token = '5csotzAAQq1fe1iL9CA6yw3P5abQ71Ana/2R3ST9VK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032