UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pb6EwH0PliDjHxehrn7ZKIoPeZzqnANGuGZzaDXY+8c=' 
WHERE 
  key_id = 'c9f15c5a353269014bc885ff9b46168fefd59a2af3d7f346fd155f41c6e1e51f' 
  AND (
    token = 'Pb6EwH0PliDjHxehrn7ZKIoPeZzqnANGuGZzaDXY+8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027