UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T/KZBxZs7y8xCTsHZgFVtNy8e4nZoJoo6Q1hIrDqYDs=' 
WHERE 
  key_id = 'c7314bad9176beb1cc98f618b7aeb2691c3d866f3ef50ce5f4f1e431ec39927c' 
  AND (
    token = 'T/KZBxZs7y8xCTsHZgFVtNy8e4nZoJoo6Q1hIrDqYDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037