UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0/0bVv+xDq9ilkdjLwomtTOFXuxf4Pum86OOVlDBbeI=' 
WHERE 
  key_id = '10ca2a13b072c8f4a5a013630fb820531aaff85e4beff265d32adc2d8978df2c' 
  AND (
    token = '0/0bVv+xDq9ilkdjLwomtTOFXuxf4Pum86OOVlDBbeI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042