UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lexq8CbH/9WLkYWLhWIZqOzN/sz2EtYI42ell+juvPQ=' 
WHERE 
  key_id = 'bae6775f32f310c20db753419307342454794ad6a5e897af9c4557a47436e6f2' 
  AND (
    token = 'lexq8CbH/9WLkYWLhWIZqOzN/sz2EtYI42ell+juvPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032