UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1Fo1cOiO51eSXgMM3gQlBBP66+ZC/0Jdt0p1SEtEiI=' 
WHERE 
  key_id = '004b1cf81a3b085afc806cbd1398bcb5ea427930bed90af29bc77088193c8509' 
  AND (
    token = 'k1Fo1cOiO51eSXgMM3gQlBBP66+ZC/0Jdt0p1SEtEiI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028