UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XCYcFHwU3Wv49yVKOPw8eKDn2bfF58FSUu+gowGaaWc=' 
WHERE 
  key_id = '492f97ad0738889ca588571e683928027aa87b2f130e87ce8ed29e72b5231630' 
  AND (
    token = 'XCYcFHwU3Wv49yVKOPw8eKDn2bfF58FSUu+gowGaaWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047