UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BaEEK9PZ3J6VWer+Um0vk3Vz603jchFjm3yqLhthrpU=' 
WHERE 
  key_id = '1b93707486ffa2f697c79fe61dc8989b7f9882aa9f33a0acf3d21b6b28b06d11' 
  AND (
    token = 'BaEEK9PZ3J6VWer+Um0vk3Vz603jchFjm3yqLhthrpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031