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

Query time 0.00048