UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd2h5nH2UxPDJAnOOucUmncSN01zD4yii3suuAUSfyrk=' 
WHERE 
  key_id = '10bb1d34c0b67cc1f7d441bc228d0f9b426267044674231cf742d39adfd94d41' 
  AND (
    token = 'd2h5nH2UxPDJAnOOucUmncSN01zD4yii3suuAUSfyrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029