UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GpVXgTHNUfgb1WbfDJWgyrfg95hyGoYaMfMbosaNygI=' 
WHERE 
  key_id = '2f1d6df68a9f6cbb84d984e738c6d160676e733da58b2890e72c912019672c01' 
  AND (
    token = 'GpVXgTHNUfgb1WbfDJWgyrfg95hyGoYaMfMbosaNygI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032