UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7mCZlU4s11/o52Y15cSmdI+8FeBnRBuWzsgS47QpbgM=' 
WHERE 
  key_id = 'e049f8bdc3f342ab838620c61ec8f4f8f23a2f8c08d65956e319809298b6087b' 
  AND (
    token = '7mCZlU4s11/o52Y15cSmdI+8FeBnRBuWzsgS47QpbgM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034