UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k8LyYaEUzfeeAp2a55JXvBb6C0p7mFgDHfGEEWFzNtI=' 
WHERE 
  key_id = '6e5421ab30351479778196d1d56f012414f11af640f4cf1d07c0b8a33b2752d2' 
  AND (
    token = 'k8LyYaEUzfeeAp2a55JXvBb6C0p7mFgDHfGEEWFzNtI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049