UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0KIT99kf+H7h1yk74GDi7rHo15JXn3OXphctxAJTbhk=' 
WHERE 
  key_id = '38f112e30c77c6df4b5f8b6ef9b8bf15556acb3857f59b4f408fb88f8a336e6d' 
  AND (
    token = '0KIT99kf+H7h1yk74GDi7rHo15JXn3OXphctxAJTbhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032