UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u0EtMS/aHM+vcZ8g+HcgOs9EQ7U8+1vTKNbzyM5lg94=' 
WHERE 
  key_id = '4a641cbddd1576330b2d36db25f8337c727216180506bc57773c63e3ae18c4d0' 
  AND (
    token = 'u0EtMS/aHM+vcZ8g+HcgOs9EQ7U8+1vTKNbzyM5lg94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076