UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J8hE4RvmwXoLHQLtzRGPaylNwbjwaJqfaIiEnteLp80=' 
WHERE 
  key_id = '7876eabd5f9db03d9f218d12457d6b8083e1d51bc162478556c4c91df629c28f' 
  AND (
    token = 'J8hE4RvmwXoLHQLtzRGPaylNwbjwaJqfaIiEnteLp80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034